home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
ratbas.arc
/
TEST.RAT
< prev
Wrap
Text File
|
1982-11-01
|
2KB
|
115 lines
' TEST Program to test RT Translator
DIM Names$(200)
Maxnames=200
INCLUDE SORT]
Procedure Getkey]
for i.getkey=1 to 10: fromuser$=inkey$: next
while fromuser$="": fromuser$=inkey$: wend
pend]
Procedure GetSelection(v:ifunc.get)]
cls
print "Menu For Sort Program
print
print "1 Enter a List of Names from Keyboard"
print "2 Display the Names"
print "3 Read a list of Names from a disk file"
print "4 Write the list of Names to a disk file"
print "5 Sort the Names alphabetically"
print "10 End the Program
print
print "Strike Function Key for your choice"
choicemade%=false
while not choicemade%
getkey]
if len(fromuser$)=2 then]
ifunc.get=asc(mid$(fromuser$,2,1))-58
else]
ifunc.get=0
ifend]
choicemade%=ifunc.get=10 or (ifunc.get>=1 and ifunc.get<=5)
wend
pend]
Procedure Enternames]
cls
locate 25,1
Print "Enter Names. Use a Null Line to quit";
locate 1,1,1
numnames=0
line input namein$
while namein$<>"" and numnames<maxnames
numnames=numnames+1
names$(numnames)=namein$
line input namein$
wend
pend]
Procedure Displaynames]
for j=1 to numnames step 20
klast=j+19: if klast>numnames then klast=numnames
cls
for k=j to klast
Print names$(k)
next k
print
print "Press Space Bar to Continue;
Getkey]
next j
pend]
Procedure Readnames]
cls
numnames=0
print
Input "Enter Name of File with input ";file$
Open file$ for input as #1
while not eof(1) and numnames<maxnames
line input #1, namein$
numnames=numnames+1
names$(numnames)=namein$
print ".";
wend
close #1
pend]
Procedure Writenames]
cls
print
Input "Enter Name of File to write names";file$
Open file$ for output as #1
for j=1 to numnames
Print #1, names$(j)
print ".";
next j
close #1
pend]
PROGRAM]
key off
for k=1 to 10
key k,""
next k
cls
Print "Program to Sort a List of Names"
GetSelection(choice)]
while choice<10
CASE Choice OF]
1 :]
Enternames]
2 :]
Displaynames]
3 :]
Readnames]
4 :]
Writenames]
5 :]
Sort]
CEND]
Getselection(choice)]
wend
END